﻿using System.ComponentModel.DataAnnotations;

namespace Magicodes.WeChat.Application.Pay.Dto
{
    public class ToPayInput
    {
        /// <summary>
        /// 不传则自动获取
        /// </summary>
        public string OpenId { get; set; }
        /// <summary>
        ///     支付金额
        /// </summary>
        [Required]
        [Range(0.01, 9999999)]
        public decimal Amount { get; set; }

        /// <summary>
        ///     交易单号
        /// </summary>
        [MaxLength(32)]
        public string TradeNo { get; set; }

        /// <summary>
        ///     商品描述
        /// </summary>
        [Required(ErrorMessage = "请务必填写商品简单描述")]
        [MaxLength(128, ErrorMessage = "商品简单描述不能超过128个字符")]
        public string Remark { get; set; }

        /// <summary>
        ///     自定义数据
        ///     支持JSON格式，如：{"key":"订单支付","orderId":"aaaaaaaaaa"}
        /// </summary>
        [MaxLength(127)]
        public string CustomData { get; set; }

        /// <summary>
        /// 交易类型（不填则自动判断）
        /// </summary>
        public TradeTypes? TradeType { get; set; }

        /// <summary>
        /// WAP网站名称，仅WAP支付
        /// </summary>
        public string WapName { get; set; }

        /// <summary>
        /// WAP网站地址，仅WAP支付
        /// </summary>
        public string WapUrl { get; set; }


    }

    /// <summary>
    /// 交易类型
    /// </summary>
    public enum TradeTypes
    {
        /// <summary>
        /// 微信支付
        /// </summary>
        WeChat = 0,
        /// <summary>
        /// H5支付
        /// </summary>
        H5 = 1,
        /// <summary>
        /// APP支付
        /// </summary>
        App = 2,
        /// <summary>
        /// 扫码支付
        /// </summary>
        QrCode = 3
    }
}